<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>masonry-layout</title>
    <style>
        .masonry-container {
            --column-count-small--: 1;
            --column-count-medium--: 2;
            --column-count-large--: 3;
            --column-gap--: .125rem;
            padding: var(--column-gap--);
        }

        .masonry-columns {
            column-gap: var(--column-gap--);
            column-count: var(--column-count-small--);
            column-width: calc(1 / var(--column-count-small--) * 100%);
        }

        @media only screen and (min-width: 640px) {
            .masonry-columns {
                column-count: var(--column-count-medium--);
                column-width: calc(1 / var(--column-count-medium--) * 100%);
            }
        }

        @media only screen and (min-width: 800px) {
            .masonry-columns {
                column-count: var(--column-count-large--);
                column-width: calc(1 / var(--column-count-large--) * 100%);
            }
        }

        .masonry-brick {
            width: 100%;
            height: auto;
            object-fit: cover;
            border-radius: 50%;
            margin: var(--column-gap--);
            display: block;
        }

        .masonry-brick:first-child {
            margin: 0 0 var(--column-gap--);
        }
    </style>
</head>

<body>
    <div class="masonry-container">
        <div class="masonry-columns">
            <img class="masonry-brick" src="https://www.eveningwater.com/img/segmentfault/1.png" alt="An image" />
            <img class="masonry-brick" src="https://www.eveningwater.com/img/segmentfault/2.png" alt="Another image" />
            <img class="masonry-brick" src="https://www.eveningwater.com/img/segmentfault/3.png" alt="Another image" />
            <img class="masonry-brick" src="https://www.eveningwater.com/img/segmentfault/4.png" alt="One more image" />
            <img class="masonry-brick" src="https://www.eveningwater.com/img/segmentfault/5.png" alt="And another one" />
            <img class="masonry-brick" src="https://www.eveningwater.com/img/segmentfault/6.png" alt="Last one" />
        </div>
    </div>
</body>

</html>